import wepy from 'wepy'
// 定义变量保存请求根路径
const baseUrl = 'https://www.zhengzhicheng.cn/api/public/v1'

// 封装全局通用的toast提示
wepy.baseToast = function (tit='获取数据失败'){
    wepy.showToast({
        title: tit,
        icon: 'none',
        duration: 2000
      })
}

// 封装get请求
wepy.get = function (url,data={}) {
    return wepy.request({
        url: baseUrl + url,
        method: 'GET',
        data: data
      });
}

// 封装post请求
wepy.post = function (url,data={}) {
    return wepy.request({
        url: baseUrl + url,
        method: 'POST',
        data: data
      });
}